package com.example.okhttptest;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class PingActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ping);
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (PingUtil.ping()) {
                    Toast.makeText(PingActivity.this, "通", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(PingActivity.this, "不通", Toast.LENGTH_SHORT).show();
                }
            }
        });

    }
}
